package ControlLayer;

import ModelLayer.*;
import DBLayer.*;
import java.util.ArrayList;
/**
 */
public class CtrCustomerGroup {

        public CtrCustomerGroup() {

        }
        
        
        public void NewCtrCustomerGroup(CustomerGroup cusGObj)
      {
           IFDBCustomerGroup dbCusG = new DBCustomerGroup();
           dbCusG.insertCustomerGroup(cusGObj);
      }
        
       public void updateCustomerGroup(String description, String privat, String business, double credit,int cvr, int customerGroupID, Boolean type, Customer customerID)
        {
        IFDBCustomerGroup dbCusg = new DBCustomerGroup();       
        CustomerGroup cusg = new CustomerGroup();
        cusg.setDescription(description);
	cusg.setCredit(credit);
        cusg.setCvr(cvr);
        cusg.setType(type);       
        dbCusg.updateCustomerGroup(cusg);
     }

       
        // Cid Står for CostumerID fra database modelen.
     public void deleteCustomerGroup(int cgid) 
     {
	IFDBCustomerGroup dbCusg = new DBCustomerGroup();
	dbCusg.deleteCustomer(cgid);
    }


      public CustomerGroup findById(int cgid)
    {
        IFDBCustomerGroup dbCusg = new DBCustomerGroup();
        return dbCusg.findCustomerGroup( cgid, true);
    }

     
    public ArrayList GetAllCustomers()
    {
      IFDBCustomerGroup dbCusg = new DBCustomerGroup();
      ArrayList allCusg = new ArrayList();
      allCusg = dbCusg.getAllCustomerGroup(false);
      return allCusg;
    }
         
}
